package com.itheima.test;

import java.util.Scanner;

/**
 * @Author 王加鑫
 * @Date 2021/4/14 19:23
 * @Version 1.0
 * 需求:键盘录入一个四位数,将其拆分为个位,十位,百位,千位后,打印在控制台
 */
public class OperatorDemo03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个四位数:");
        int num = sc.nextInt();
        int ge = num % 10;
        int shi = num / 10 % 10;
        int bai = num / 10 / 10 % 10;
        int qian = num / 1000;
        System.out.println("键盘录入的"+num+"的个位是"+ge);
        System.out.println("键盘录入的"+num+"的十位是"+shi);
        System.out.println("键盘录入的"+num+"的百位是"+bai);
        System.out.println("键盘录入的"+num+"的千位是"+qian);
    }
}
